package com.nbsaas.boot.marketing.rest.resource;

import com.nbsaas.boot.marketing.api.apis.UserPointsApi;
import com.nbsaas.boot.marketing.data.entity.UserPoints;
import com.nbsaas.boot.marketing.api.domain.request.UserPointsRequest;
import com.nbsaas.boot.marketing.api.domain.response.UserPointsResponse;
import com.nbsaas.boot.marketing.api.domain.simple.UserPointsSimple;
import com.nbsaas.boot.marketing.rest.convert.UserPointsSimpleConvert;
import com.nbsaas.boot.marketing.rest.convert.UserPointsEntityConvert;
import com.nbsaas.boot.marketing.rest.convert.UserPointsResponseConvert;
import com.nbsaas.boot.marketing.data.repository.UserPointsRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   用户积分-业务接口实现
*/
@Transactional
@Service
public class UserPointsResource extends BaseResource<UserPoints,UserPointsResponse, UserPointsSimple, UserPointsRequest>  implements UserPointsApi {

    @Resource
    private UserPointsRepository userPointsRepository;

    @Override
    public JpaRepositoryImplementation<UserPoints, Serializable> getJpaRepository() {
        return userPointsRepository;
    }

    @Override
    public Function<UserPoints, UserPointsSimple> getConvertSimple() {
        return new UserPointsSimpleConvert();
    }

    @Override
    public Function<UserPointsRequest, UserPoints> getConvertForm() {
        return new UserPointsEntityConvert();
    }

    @Override
    public Function<UserPoints, UserPointsResponse> getConvertResponse() {
        return new UserPointsResponseConvert();
    }




}


